﻿<?php 


class Admin_index extends CI_Controller{
	
	
	function __construct(){
		parent::__construct();
		$this->load->helper('url');
		$this->load->library('Page_smart');
		$this->load->model('w3a_model');
		$this->load->model('w3a_admin');
		
	}
	//登陆
	function login(){
		$this->load->view('admin/login');
	}
	//主页
	function index(){
		//获取分类列表
		$this->load->view('admin/index');		
	}
	//添加文章
	function add_article(){
		$data['cat_list'] = $this->w3a_model->get_category_list();
		$this->load->view('admin/add_article_show',$data);
	}

	//添加分类
	function add_category_show(){
		$this->load->view('admin/add_category_show');
	}
	//文章列表
	function article_show(){
		$config['page']=$this->uri->segment(3); //当前页面
        $config['rows']=$this->w3a_model->get_all(); //总数
		$config['base_url']=site_url('admin/admin_index/article_show/');
                $page_rst=$this->page_smart->page_do($config);
		$data['art_list']=$this->w3a_model->get_list($page_rst['select_from'],$page_rst['select_limit']);
		$data['page_list']=$page_rst['pagenav'];

		$this->load->view('admin/check_article',$data);
	}
	//修改文章
	function edit_article($art_id){
		$data['cat_list'] = $this->w3a_model->get_category_list();
		$data['art_mes'] = $this->w3a_admin->fine_art($art_id);
		$this->load->view('admin/edit_article_show',$data);
	}
	//栏目列表
	function cat_list(){
		$data['cat_list'] = $this->w3a_admin->get_CatList();
		$this->load->view('admin/check_category_show',$data);
	
	}
	//删除文章
	function del_article($art_id){
		$data['art_list'] = $this->w3a_admin->del_article($art_id);
	}
	//信息管理
	function mes_manager(){
		$data['mes'] = $this->w3a_admin->get_mes();
//                print_r($data);die();
		$this->load->view('admin/index_manager',$data);
	}
	//修改栏目
	function edit_category(){
		$data['art_list'] = $this->w3a_admin->cat_name($this->uri->segument(4));
		
	}
	//回收站
	function remove(){
		$data['art_list'] = $this->w3a_admin->get_remove();
		$this->load->view('admin/remove',$data);
	}
	//恢复文章
	function recover($art_id){
		$data['art_list'] = $this->w3a_admin->recover($art_id);
	}
}